class SubtractError(BaseException):
    def __init__(self, msg):
        BaseException.__init__(self, msg)

    def __str__(self):
        return BaseException.__str__(self)

    def __repr__(self):
        return BaseException.__repr__(self)


def xsubstract(a, b):
    if a < b:
        raise SubtractError('被减数不能小于减数！')
    return a - b


for a, b in ((2, 1), (3, 2), (1, 3), (100, 99), (1, 10000), (5, 4)):
    try:
        print(f'{a} - {b} = {xsubstract(a, b)}')
    except SubtractError as ex:
        print(f'{a} - {b}: {ex!s} ({ex!r})')
